package com.hzw.saas.service.project.bo;

import com.hzw.saas.service.project.enums.FlowType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author hankun
 */
@Data
public class ProjectApplyScrollBo {
    private static final String FORMATTER = "{'title':'%s %s老师', 'text':'“%s” %s'}";

    @ApiModelProperty("机构 or 学校")
    private String company;

    @ApiModelProperty("[姓]老师")
    private String realName;

    @ApiModelProperty("项目名称")
    private String projectName;

    @ApiModelProperty("项目成功立项[1004] or 项目验收成功[1014]")
    private String flowNodeId;

    public String convert() {
        return String.format(FORMATTER, company, realName.charAt(0), projectName, FlowType.getDescByCode(flowNodeId));
    }

    public ProjectApplyNoticeBO toNotice() {
        ProjectApplyNoticeBO projectApplyNoticeBO = new ProjectApplyNoticeBO();
        projectApplyNoticeBO.setTitle(String.format("%s %s老师", company, realName.charAt(0)));
        projectApplyNoticeBO.setText(String.format("“%s” %s", projectName, FlowType.getDescByCode(flowNodeId)));
        return projectApplyNoticeBO;
    }

}
